package chapter92;

public class Triangle {

    int a;
    int b;
    int c;

    //构造方法对属性进行赋值
    public  Triangle(int a1,int b1,int c1){
        a=a1;
        b=b1;
        c=c1;

    }

    public boolean ValidateTriangle(){
        if(a+b<=c){
            return false;
        }else if(a+c<=b){
            return false;
        }else if(b+c<=a){
            return false;
        }
        return true;
    }

    public void show(){
        boolean flag= ValidateTriangle();
        if(flag){
            System.out.println("三条边为"+a+","+b+","+c+"长度，能组成三角形");
        }else {
            System.out.println("三条边为"+a+","+b+","+c+"长度，不能组成三角形");
        }

    }
}
